<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>颜色选择</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }

        select,
        button {
            margin: 10px;
            padding: 5px;
        }

        #text {
            margin-top: 20px;
            font-size: 24px;
        }
    </style>
</head>

<body>
    <select id="colorSelect">
        <option value="red">红色</option>
        <option value="yellow">黄色</option>
        <option value="blue">蓝色</option>
    </select>
    <button onclick="changeColor()">确定</button>
    <p id="text">这是一段文字</p>
    <script>
        function changeColor() {
            const select = document.getElementById('colorSelect');
            const selectedColor = select.value;
            const text = document.getElementById('text');
            text.style.color = selectedColor;
        }
    </script>
</body>

</html>
    